package com.example.demo.mapper;

import com.example.demo.entity.po.UserEntity;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.BaseMapper;

import java.util.List;
import java.util.Map;

/**
 *  
 * @author generate     
 * @version 1.0.0 2018-05-14 11:20:30
 */
@Mapper
public interface UserMapper extends BaseMapper<UserEntity> {
    @Select("select * from user where name = #{name}")
    UserEntity selectByUserName(String name);

    @Select("select * from user where name like concat(concat('%',#{name}),'%')")
    UserEntity selectByLikeUserName(String name);

    @Select("select * from user where name = #{name}")
    List<UserEntity> selectListByUserName(String name);

    @Update("update user set age=${age} where id =#{id}")
    @Results({
            @Result(property = "age", column = "AGE"),
            @Result(property = "id", column = "ID")
    })
    Integer updateUser(UserEntity userEntity);

    List<UserEntity> findUserByCondition(UserEntity userEntity);

    List<UserEntity> selectByTime(Map map);


    List<Map> selectGroupByTime(Map map);
}

